package Gather.SetExercise;

import java.util.LinkedHashSet;

/**
 * ClassName:LinkedHashSetText002
 * Package:Gather.SetExercise
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/2/9-12:47
 * @Version:v1.0
 */
public class LinkedHashSetText002 {
    public static void main(String[] args) {
        Student s1 = new Student("zhangsan",23);
        Student s2 = new Student("lisi",24);
        Student s3 = new Student("wangwu",25);
        Student s4 = new Student("zhangsan",23);

        //创建集合对象
        LinkedHashSet<Student> lhs = new LinkedHashSet<>();
        System.out.println(lhs.add(s2));
        System.out.println(lhs.add(s1));
        System.out.println(lhs.add(s4));
        System.out.println(lhs.add(s3));

        for (Student str : lhs) {
            System.out.println(str);
        }
    }
}
